package com.eastfair.notice.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 消息发送记录
 * </p>
 *
 * @author liuxiaobai
 * @since 2021-08-30
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_msg_log")
@ApiModel(value = "MsgLog", description = "消息发送记录")
@AllArgsConstructor
public class MsgLog extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    @ApiModelProperty(value = "")
    @TableField(value = "project_id")
    @Excel(name = "")
    private Long projectId;

    @ApiModelProperty(value = "")
    @TableField(value = "exhibition_id")
    @Excel(name = "")
    private Long exhibitionId;

    /**
     * 消息类型 sms、email
     */
    @ApiModelProperty(value = "消息类型 sms、email")
    @Size(max = 32, message = "消息类型 sms、email长度不能超过32")
    @TableField(value = "type", condition = LIKE)
    @Excel(name = "消息类型 sms、email")
    private String type;

    /**
     * db_imaster_public.c_msg_content.id
     */
    @ApiModelProperty(value = "db_imaster_public.c_msg_content.id")
    @TableField(value = "temp_id")
    @Excel(name = "db_imaster_public.c_msg_content.id")
    private Long tempId;

    /**
     * 接收人类型（展商、员工、观众）
     */
    @ApiModelProperty(value = "接收人类型（展商、员工、观众）")
    @Size(max = 32, message = "接收人类型（展商、员工、观众）长度不能超过32")
    @TableField(value = "receive_type", condition = LIKE)
    @Excel(name = "接收人类型（展商、员工、观众）")
    private String receiveType;

    /**
     * 接收人ID
     */
    @ApiModelProperty(value = "接收人ID")
    @TableField(value = "receive_id")
    @Excel(name = "接收人ID")
    private Long receiveId;

    /**
     * 接收人email、mobile、imUserId
     */
    @ApiModelProperty(value = "接收人email、mobile、imUserId")
    @Size(max = 255, message = "接收人email、mobile、imUserId长度不能超过255")
    @TableField(value = "receive", condition = LIKE)
    @Excel(name = "接收人email、mobile、imUserId")
    private String receive;

    /**
     * 发送内容
     */
    @ApiModelProperty(value = "发送内容")
    @Size(max = 65535, message = "发送内容长度不能超过65535")
    @TableField(value = "content", condition = LIKE)
    @Excel(name = "发送内容")
    private String content;

    /**
     * 是否成功
     */
    @ApiModelProperty(value = "是否成功")
    @TableField(value = "status")
    @Excel(name = "是否成功", replace = {"是_true", "否_false", "_null"})
    private Boolean status;

    /**
     * 错误信息
     */
    @ApiModelProperty(value = "错误信息")
    @Size(max = 65535, message = "错误信息长度不能超过65535")
    @TableField(value = "err_msg", condition = LIKE)
    @Excel(name = "错误信息")
    private String errMsg;


    @Builder
    public MsgLog(Long id, Long updatedBy, LocalDateTime updateTime, Long createdBy, LocalDateTime createTime, 
                    Long projectId, Long exhibitionId, String type, Long tempId, String receiveType, 
                    Long receiveId, String receive, String content, Boolean status, String errMsg) {
        this.id = id;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.projectId = projectId;
        this.exhibitionId = exhibitionId;
        this.type = type;
        this.tempId = tempId;
        this.receiveType = receiveType;
        this.receiveId = receiveId;
        this.receive = receive;
        this.content = content;
        this.status = status;
        this.errMsg = errMsg;
    }

}
